import http from '@/http/http'
import { AddUserParams, EditUserParams, UpdatePwdParams, UpdateUserAuthParams } from '@/views/account/interface/interface'
import { GetUrl } from '@/interface/index'
enum Api {
  addUser = '/manage/admin/userInfo/addUser',
  // editUser = '/manage/admin/userInfo/updateUser',
  editUser = '/manage/admin/userInfo/edit',
  getAreaList = '/manage/admin/pubAreaInfo/getAreaList',
  getNewAreaList = '/manage/admin/pubAreaInfo/getMyTownList',
  getTown = '/manage/admin/pubAreaInfo/getTown',
  userDetail = '/manage/admin/userInfo/userDetail',
  updatePwd = '/manage/admin/userInfo/updatePwd',
  updateUserAuth = '/manage/admin/userInfo/updateUserAuth',
  turnOff = '/manage/admin/userInfo/turnOff',
  getDetail = '/manage/admin/reportRectify/pcTotalReport',
  getDetailOne='/manage/admin/reportRectify/pcOneReport'
}
//添加用户
export const addUserApi = async (params: AddUserParams) => {
  return await http.post(Api.addUser, params)
}
//编辑用户
export const editUserApi = async (params: EditUserParams) => {
  return await http.put(Api.editUser, params)
}
//获取所有镇数据
export const getAreaListApi = async (params: GetUrl) => {
  return await http.getUrl(Api.getAreaList, params)
}
//获取当前角色镇数据
export const getNewAreaListApi = async () => {
  return await http.getUrl(Api.getNewAreaList)
}
//获取用户当前所在镇之外的其他镇
export const getTownApi = async (params: any) => {
  return await http.getUrl(Api.getTown, params)
}
//获取用户详情
export const userDetailApi = async (params: GetUrl) => {
  return await http.getUrl(Api.userDetail, params)
}
//修改密码
export const updatePwdApi = async (params: UpdatePwdParams) => {
  return await http.put(Api.updatePwd, params)
}
//是否开通管理员权限
export const updateUserAuthApi = async (params: UpdateUserAuthParams) => {
  return await http.put(Api.updateUserAuth, params)
}
//账号转移
export const turnOffApi = async (params: any) => {
  return await http.put(Api.turnOff, params)
}

//获取隐患详情
export const getDetailApi = async (id:string) => {
  return await http.getUrl(`${Api.getDetail}/${id}`)
}

//获取隐患详情
export const getDetailOneApi = async (id:string) => {
  return await http.getUrl(`${Api.getDetailOne}/${id}`)
}